USE DB_TCC
GO
IF EXISTS(SELECT 1 FROM SYSOBJECTS WHERE NAME LIKE 'P_CLIENTE_LISTAR')
	DROP PROCEDURE P_CLIENTE_LISTAR
GO
CREATE PROCEDURE P_CLIENTE_LISTAR(
	@NOMECLIENTE VARCHAR(100))
AS BEGIN
	SELECT
		CLI_IDCLIENTE,
		CLI_NMCLIENTE,
		CLI_DESCCLIENTE,
		CLI_ICATIVO,
		CLI_NMUSUARIOINCLUSAO,
		CLI_DTHRINCLUSAO,
		CLI_NMUSUARIOALTERACAO,
		CLI_DTHRALTERACAO
	FROM
		CLIENTE
	WHERE
		(CLI_NMCLIENTE LIKE '%' + @NOMECLIENTE + '%' OR CONVERT(VARCHAR(100), @NOMECLIENTE) IS NULL)
		AND CLI_ICATIVO = 'S'
END